#include "Task.h"

Task::Task(int id, string data) : _id(id),_data(data){
	pthread_cond_init(&_taskCondVar,NULL);
	_hasBeenWritten = false;
}

Task::~Task(){
	pthread_cond_destroy(&_taskCondVar);
}

int Task::getID(){
	return _id;
}

string Task::getData(){
	return _data;
}

bool Task::hasBeenWritten(){
	return _hasBeenWritten;
}

void Task::taskWasWritten(){
	_hasBeenWritten = true;
	//indicating the task was written to the file:
	pthread_cond_broadcast(&_taskCondVar);
}

pthread_cond_t* Task::getTaskCondVar(){
	return &_taskCondVar;
}
